// app.js
App({
  onLaunch() {
    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)

    // 登录
    wx.login({
      success: res => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
        console.log(res)
        console.log(this.globalData.userInfo)
        if(!wx.getStorageSync('openId')){
          wx.reLaunch({
            url: '/pages/auth/auth',
          })
        }
      }
    })
  },
  globalData: {
    userInfo: null,
    server:'https://qiubao.ltd/球宝',
    coupons: [],
    total_coupons: 0,
    unpaid: false,   //未支付情况
    unpaid_info: [],  //未支付的订单
    openID: '',      //记录用户的openID
    device_id: '无'
  }
})
